<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="../../css/bootstrap/bootstrap.min.css" />
        <link rel="stylesheet" type="text/css" href="../../css/easyui/default/easyui.css"/>
        <script type="text/javascript" src="../../js/jquery.min.js"></script>
        <script type="text/javascript" src="../../js/bootstrap/bootstrap.min.js"></script>
        <script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="../../js/easyui/easyui-lang-zh_CN.js"></script>
        <script type="text/javascript" src="../../js/self/util.js"></script>
        <script type="text/javascript" src="../../js/self/ssm.module.js"></script>
        <script type="text/javascript">
            function startTask(button_update) {
                var $td = $(button_update).parent("td").parent("tr").children("td:first");
                $.ajax({
                    type: "post",
                    url: "/attack-task/start?id=" + $td.children(":hidden[name='hidden_id']").val(),
                    contentType: "application/json;charset=utf-8",
                    success: function (result) {
                        var code = result.code;
                        if (code == 0) {
                            $.messager.alert("提示", "操作成功!", "info", function () {
                                pager.submitForm();
                            });
                        } else {
                            $.messager.alert("提示", result.msg, "error");
                        }
                    }
                });
            }
            function endTask(button_update) {
                var $td = $(button_update).parent("td").parent("tr").children("td:first");
                $.ajax({
                    type: "post",
                    url: "/attack-task/end?id=" + $td.children(":hidden[name='hidden_id']").val(),
                    contentType: "application/json;charset=utf-8",
                    success: function (result) {
                        var code = result.code;
                        if (code == 0) {
                            $.messager.alert("提示", "操作成功!", "info", function () {
                                pager.submitForm();
                            });
                        } else {
                            $.messager.alert("提示", result.msg, "error");
                        }
                    }
                });
            }
        </script>
    </head>
    <body>
    <div id="div_operate" style="margin-bottom: 10px; margin-top: 10px;">
        <button type="button" class="btn btn-success btn-xs" id="button_add" url="/attack-task/to-operate">
            <span class="glyphicon glyphicon-plus"></span>&nbsp添加演练任务
        </button>
        <button type="button" class="btn btn-success btn-xs" id="button_refresh">
            <span class="glyphicon glyphicon-refresh"></span>&nbsp;查询
        </button>
    </div>
    <form th:action="@{/attack-task/page}" id="form_select">
        <input type="hidden" name="pageNum" th:value="1">
        <div class="form-group" style="width: 23%; float: left;margin: 10px 10px 10px 0px;">
            <label style="float: left; margin-right: 10px;">任务名称</label>
            <div style="float: left; width: 70%;">
                <input class="form-control" name="taskName" autocomplete="off">
            </div>
        </div>
        <div class="form-group" style="width: 23%; float: left;margin: 10px 10px 10px 0px;">
            <label style="float: left; margin-right: 10px;">任务描述</label>
            <div style="float: left; width: 70%;">
                <input class="form-control" name="taskDesc" autocomplete="off">
            </div>
        </div>
        <div class="form-group" style="width: 23%; float: left;margin: 10px 10px 10px 0px;">
            <label style="float: left; margin-right: 10px;">任务状态</label>
            <div style="float: left; width: 70%;">
                <select id="valid_select_taskStatus" class="form-control" name="taskStatus">
                    <option value="">---不限---</option>
                    <option value="未开始">未开始</option>
                    <option value="进行中">进行中</option>
                    <option value="已完成">已完成</option>
                </select>
            </div>
        </div>
    </form>
    <table class="table table-bordered" id="table_thead" editcol="1">
        <tr align="center">
            <td style="width: 10%;" id="td_taskName">任务名称</td>
            <td style="width: 10%;" id="td_taskDesc">任务描述</td>
            <td style="width: 10%;" id="td_relatedOrgName">组织机构</td>
            <td style="width: 10%;" id="td_joinedTesters">参与的测试人员</td>
            <td style="width: 10%;" id="td_taskStatus">任务状态</td>
            <td style="width: 10%;" id="td_startTime">任务开始时间</td>
            <td style="width: 10%;" id="td_endTime">任务结束时间</td>
            <td>操作</td>
        </tr>
    </table>
    <div style="overflow-y: scroll;" id="div_entity">
        <table class="table table-hover table-bordered" id="table_entity">
            <tbody>
            <tr>
                <td>
                    <input type="hidden" name="hidden_id">
                    <input type="hidden" name="hidden_name">
                </td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td>
                    <button type="button" class="btn btn-primary btn-xs" onclick = "startTask(this)">
                        开始任务
                    </button>
                    <button type="button" class="btn btn-success btn-xs"
                            url = "/attack-task/to-assign" window_title="任务指派-taskName" onclick = "buttonEditJump(this)">
                        任务指派
                    </button>
                    <button type="button" class="btn btn-warning btn-xs" onclick = "endTask(this)">
                        &nbsp;结束任务
                    </button>
                    <button type="button" class="btn btn-info btn-xs"
                            url = "/attack-task/to-operate" window_title="修改演练任务-taskName" onclick = "buttonEditJump(this)">
                        <span class="glyphicon glyphicon-pencil"></span>&nbsp;修改
                    </button>
                    <button type="button" class="btn btn-danger btn-xs"
                            url = "/attack-task/delete" onclick="buttonDeleteClick(this, '/attack-task/delete')">
                        <span class="glyphicon glyphicon-trash"></span>&nbsp;删除
                    </button>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <!-- 引入分页页面 -->
    <div th:replace="base/page"></div>
    </body>
</html>
